package shuashuami.hb.com.share;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by Administrator on 2017/7/4.
 */

public class ShareBUserInfo {
    // 获取SharedPreferences对象
    SharedPreferences sp;

    public ShareBUserInfo(Context context) {
        sp = context.getSharedPreferences("c_user_info", Activity.MODE_PRIVATE);
    }

    public void setAllInfo(String id, String agentnum, String email, String parentId,
                           String password, String phone, String qq, String realName, String avatar, String sn, String userName) {
        setId(id);
        setAgentnum(agentnum);
        setEmail(email);
        setParent_id(parentId);
        setPassword(password);
        setPhoneNum(phone);
        setQQ(qq);
        setRealname(realName);
        setUserAvatar(avatar);
        setwx_sn(sn);
        setUsername(userName);
    }

    public void setPhoneNum(String str) {
        // 获取Editor对象
        SharedPreferences.Editor editor = sp.edit();
        editor.putString("phone_num", str);
        editor.commit();
    }

    public String getPhoneNum() {
        String result = sp.getString("phone_num", "");
        return result;
    }

    public void setUserAvatar(String str) {
        // 获取Editor对象
        SharedPreferences.Editor editor = sp.edit();
        editor.putString("avatar", str);
        editor.commit();
    }

    public String getUserAvatar() {
        String result = sp.getString("avatar", "");
        return result;
    }

    public void setId(String str) {
        // 获取Editor对象
        SharedPreferences.Editor editor = sp.edit();
        editor.putString("id", str);
        editor.commit();
    }

    public String getId() {
        String result = sp.getString("id", "");
        return result;
    }

    public void setUsername(String str) {
        // 获取Editor对象
        SharedPreferences.Editor editor = sp.edit();
        editor.putString("Username", str);
        editor.commit();
    }

    public String getUsername() {
        String result = sp.getString("Username", "");
        return result;
    }

    public void setPassword(String str) {
        // 获取Editor对象
        SharedPreferences.Editor editor = sp.edit();
        editor.putString("Password", str);
        editor.commit();
    }

    public String getPassword() {
        String result = sp.getString("Password", "");
        return result;
    }

    public void setRealname(String str) {
        // 获取Editor对象
        SharedPreferences.Editor editor = sp.edit();
        editor.putString("realname", str);
        editor.commit();
    }

    public String getRealname() {
        String result = sp.getString("realname", "");
        return result;
    }

    public void setQQ(String str) {
        // 获取Editor对象
        SharedPreferences.Editor editor = sp.edit();
        editor.putString("QQ", str);
        editor.commit();
    }

    public String getQQ() {
        String result = sp.getString("QQ", "");
        return result;
    }

    public void setEmail(String str) {
        // 获取Editor对象
        SharedPreferences.Editor editor = sp.edit();
        editor.putString("email", str);
        editor.commit();
    }

    public String getEmail() {
        String result = sp.getString("email", "");
        return result;
    }

    public void setwx_sn(String str) {
        // 获取Editor对象
        SharedPreferences.Editor editor = sp.edit();
        editor.putString("wx_sn", str);
        editor.commit();
    }

    public String getwx_sn() {
        String result = sp.getString("wx_sn", "");
        return result;
    }

    public void setAgentnum(String str) {
        // 获取Editor对象
        SharedPreferences.Editor editor = sp.edit();
        editor.putString("agentnum", str);
        editor.commit();
    }

    public String getAgentnum() {
        String result = sp.getString("agentnum", "");
        return result;
    }

    public void setParent_id(String str) {
        // 获取Editor对象
        SharedPreferences.Editor editor = sp.edit();
        editor.putString("parent_id", str);
        editor.commit();
    }

    public String getParent_id() {
        String result = sp.getString("parent_id", "");
        return result;
    }
}
